import java.util.*;

public class Solution {

    public static void main(String[] args) {
        /*Scanner in = new Scanner(System.in);
        //输入区间左右边界
        int left = in.nextInt();
        int right = in.nextInt();
        int count = two_find_count(left, right);
        System.out.println(count);*/
 /*       ArrayList<Integer> list1 = new ArrayList<>();
        list1.add(1);
        list1.add(2);
        list1.add(3);
        ArrayList<Integer> list2 = new ArrayList<>();
        list2.add(8);
        list2.add(2);
        list2.add(2);
        list2.add(3);
        list2.add(8);
        ArrayList<Integer> result = intersection(list1, list2);
        for (Integer i : result) {
            System.out.println(i);
        }*/

        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        Stack<Character> result = click(s);
        //返回队列没有元素
        if(result.size() == 0) {
            System.out.print(0);
        }else{
            for(Character c : result) {
                System.out.print(c);
            }
        }
    }

    /*寻找区间内2的个数*/
    public static int two_find_count(int left, int right) {
        int count = 0;
        for (int i = left; i <= right; i++) {
            int n = i;
            if (n < 10) {
                if (n == 2) {
                    count++;
                }
            } else {
                while (n > 0) {
                    int tmp = n % 10;
                    n = n / 10;
                    if (tmp == 2) {
                        count++;
                    }
                }
            }
        }
        return count;
    }

    /*给定整数，返回公共元素*/
    public static ArrayList<Integer> intersection(ArrayList<Integer> nums1, ArrayList<Integer> nums2) {
        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
        for (int i : nums1) {
            map.put(i, 1);
        }
        for (int i : nums2) {
            if (map.containsKey(i)) {
                map.put(i, map.get(i) + 1);
            }
        }
        ArrayList<Integer> resultList = new ArrayList<Integer>();
        //遍历map
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            if (entry.getValue() > 1) {
                resultList.add(entry.getKey());
            }
        }
        return resultList;
    }

    /*消除元素*/
    public static Stack<Character> click(String s) {
        int n = s.length();
        Stack<Character> stack = new Stack<>();
        for(int i = 0; i < n; i++) {
            char c = s.charAt(i);
            //没有元素
            if(stack.size() == 0) {
                //元素入栈
                stack.push(c);
            }
            //队列有元素判断是否可以消除
            else if(stack.peek() == c) {
                stack.pop();
                continue;
            }
            //队列有元素，但不能消除
            else{
                stack.push(c);
            }
        }
        return stack;
    }
}
